package com.shop.controller;

import com.shop.annotation.RequireRoles;
import com.shop.model.vo.ElasticSearchLog;
import com.shop.model.PageParam;
import com.shop.model.vo.Rsp;
import com.shop.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @BelongsProject: shop
 * @BelongsPackage: com.shop.controller
 * @Author: GaoDo
 * @CreateTime: 2020-11-25 14:22
 * @Description:
 */
@RestController
public class LogController {

    @Autowired
    private LogService logService;

    /**
     * 条件查询日志
     *
     * @param pageParam
     * @return
     */
    @RequireRoles(roles = {"platform"})
    @PostMapping("getLog")
    public Rsp getLog(@RequestBody PageParam<ElasticSearchLog> pageParam) {
        return logService.searchSomeLogByPage(pageParam);
    }

    @PostMapping("getLogPV")
    public Rsp getLogPV(@RequestBody PageParam<ElasticSearchLog> pageParam) {
        return logService.searchSomeLogByPage(pageParam);
    }
}
